package net.shippo.poc.azure.iothub;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;

import com.microsoft.azure.iot.service.sdk.Device;
import com.microsoft.azure.iot.service.sdk.RegistryManager;

public class GetDeviceIdentities {
	private static final String connectionString = "HostName=iot-poc-hub.azure-devices.cn;SharedAccessKeyName=iothubowner;SharedAccessKey=OiFgE5xtwLSu/hEZtN1qXXQInP/pM/PcbKITWE/hBX4=";
	
	public static void main(String[] args)  throws IOException, URISyntaxException, Exception {
		RegistryManager registryManager = RegistryManager.createFromConnectionString(connectionString);
		ArrayList<Device> deviceList = registryManager.getDevices(100);
		for(Device device : deviceList) {
			System.out.println("------------------------------------------\nDevice Id:" + device.getDeviceId());
			System.out.println("Device Primary Key:" + device.getPrimaryKey());
			System.out.println("Device Secondary Key:" + device.getSecondaryKey());
		}
	}

}
